home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / oobr / clos-brows.el < prev    next >
Encoding:
Text File  |  1995-04-28  |  4.0 KB  |  119 lines

  1. ;;!emacs
  2. ;;
  3. ;; FILE:         clos-brows.el
  4. ;; SUMMARY:      Common Lisp/CLOS source code browser.
  5. ;; USAGE:        GNU Emacs Lisp Library
  6. ;; KEYWORDS:     lisp, oop, tools
  7. ;;
  8. ;; AUTHOR:       Bob Weiner
  9. ;; ORG:          Motorola Inc.
  10. ;;
  11. ;; ORIG-DATE:    29-Jul-90
  12. ;; LAST-MOD:     26-Apr-95 at 09:49:15 by Bob Weiner
  13. ;;
  14. ;; Copyright (C) 1990-1995  Free Software Foundation, Inc.
  15. ;; See the file BR-COPY for license information.
  16. ;;
  17. ;; This file is part of the OO-Browser.
  18. ;;
  19. ;; DESCRIPTION:  
  20. ;;
  21. ;;    Use 'clos-browse' to invoke the CLOS OO-Browser.  Prefix arg prompts for
  22. ;;    name of Environment file.
  23. ;;
  24. ;; DESCRIP-END.
  25.  
  26. ;;; ************************************************************************
  27. ;;; Other required Elisp libraries
  28. ;;; ************************************************************************
  29.  
  30. (mapcar 'require '(br-start br br-clos-ft))
  31.  
  32. ;;; ************************************************************************
  33. ;;; Public functions
  34. ;;; ************************************************************************
  35.  
  36. ;;;###autoload
  37. (defun clos-browse (&optional env-file no-ui)
  38.   "Invoke the CLOS OO-Browser.
  39. This allows browsing through CLOS library and system class hierarchies.  With
  40. an optional non-nil prefix argument ENV-FILE, prompt for Environment file
  41. to use.  Alternatively, a string value of ENV-FILE is used as the
  42. Environment file name.  See also the file \"br-help\"."
  43.   (interactive "P")
  44.   (let ((same-lang (equal br-lang-prefix clos-lang-prefix)))
  45.     (if same-lang
  46.     nil
  47.       (if br-lang-prefix
  48.       (br-env-copy nil));; Save other language Environment in memory
  49.       (setq br-lang-prefix clos-lang-prefix
  50.         *br-save-wconfig* nil))
  51.     (let ((same-env (or (equal clos-env-file env-file)
  52.             (and (null env-file)
  53.                  (or clos-lib-search-dirs clos-sys-search-dirs)))))
  54.       (cond
  55.        ;; Continue browsing an Environment
  56.        ((and same-env same-lang))
  57.        ((and same-env (not same-lang))
  58.     (progn (clos-browse-setup) (br-env-copy t)))
  59.        ;;
  60.        ;; Create default Environment file specification if needed and none
  61.        ;; exists.
  62.        ;;
  63.        (t (progn (or env-file (file-exists-p clos-env-file)
  64.              (br-env-create clos-env-file clos-lang-prefix))
  65.          (or env-file (setq env-file clos-env-file))
  66.          ;;
  67.          ;; Start browsing a new Environment.
  68.          ;;
  69.          (clos-browse-setup)
  70.          (setq *br-save-wconfig* nil
  71.                clos-env-file (br-env-init env-file same-lang nil)
  72.                clos-sys-search-dirs br-sys-search-dirs
  73.                clos-lib-search-dirs br-lib-search-dirs)
  74.          )))))
  75.   (br-init)
  76.   (or no-ui (br-browse)))
  77.  
  78. ;; Don't filter Environment classes when listed.
  79. (fset 'clos-class-list-filter 'identity)
  80.  
  81. (defun clos-class-definition-regexp (class)
  82.   "Return regexp to uniquely match the definition of CLASS name."
  83.   (concat clos-class-name-before (regexp-quote class)
  84.       clos-class-name-after))
  85.  
  86. ;;; ************************************************************************
  87. ;;; Internal functions
  88. ;;; ************************************************************************
  89.  
  90. (defun clos-browse-setup ()
  91.   "Setup language-dependent functions for OO-Browser."
  92.   (br-setup-functions)
  93.   ;; Use this until an info function is implemented for the language.
  94.   (fmakunbound 'br-insert-class-info)
  95.   (fset 'br-store-class-info 'clos-store-class-info)
  96.   (fset 'br-lang-mode
  97.     (cond ((featurep 'clos-mode) 'clos-mode)
  98.           ((load "clos-mode" 'missing-ok 'nomessage)
  99.            (provide 'clos-mode))
  100.           (t 'clos-browse-mode)))
  101.   (br-setup-constants)
  102.   ;; Setup to add default classes to system class table after building it.
  103.   ;; This must come after br-setup-constants call since it clears these
  104.   ;; hooks.
  105.   (if (fboundp 'add-hook)
  106.       (add-hook 'br-after-build-sys-hook 'clos-add-default-classes)
  107.     (setq br-after-build-sys-hook '(clos-add-default-classes))))
  108.  
  109. (defun clos-browse-mode ()
  110.   "Select major mode for browsing the current buffer's file."
  111.   (interactive)
  112.   (if (and (stringp buffer-file-name)
  113.        (not (memq major-mode '(lisp-mode emacs-lisp-mode))))
  114.       (cond ((string-match "\\.el$" buffer-file-name)
  115.          (emacs-lisp-mode))
  116.         (t (lisp-mode)))))
  117.  
  118. (provide 'clos-brows)
  119.